package com.flashflexpro.flexdirector.console.utils {
import com.flashflexpro.flexdirector.model.DtoProcedureCase;
import com.flashflexpro.flexdirector.model.DtoTestProcedure;
import com.flashflexpro.flexdirector.model.IHasProcedureCaseChildren;

public class DtoTreeUtil {
    public static function isProcedureUsedBy(  procedure:DtoTestProcedure, useCase:IHasProcedureCaseChildren ):Boolean {
        if( useCase == procedure ){
            return true;
        }
        for each( var obj:* in useCase.children ){
			var childUseCase:DtoProcedureCase = obj as DtoProcedureCase;
            if( childUseCase != null ){
                if( isProcedureUsedBy( procedure, childUseCase.originProcedure ) ){
                    return true;
                }
            }
        }
        return false;
    }
}
}